LSEEK

Section: MINTLIB LIBRARY FUNCTIONS (3)
Updated: 3 March 1993
Index Return to Main Contents
 

NAME

lseek, tell - move read/write file pointer  

SYNOPSIS

#include <unistd.h>

long lseek(int fildes, long offset, int mode);

long tell(int fd);
 

DESCRIPTION

fildes is a file descriptor returned from a creat, open, dup, or fcntl system call. lseek sets the file pointer associated with fildes as follows, according to value of the mode paramater:
- SEEK_SET (0): the pointer is set to offset bytes - SEEK_CUR (1): the pointer is set to its current
                location plus offset - SEEK_END (2): the pointer is set to the size of
                the file plus offset If the seek would set the pointer beyond the end of the file, and the file is then written to, the file is extended with zeros. If the filesystem supports sparse files, this may not take much space on disc. The obsolete function tell(fd) is equivalent to:

  lseek(fd, 0L, SEEK_CUR).  

RETURN VALUES

On success, the new position of the file pointer is returned. On failure, a negative number is returned, and errno is set.  

SEE ALSO

creat(3), dup(3), fcntl(3), fseek(3), open(3), Fseek(2)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 11:14:55 GMT, June 22, 2025